﻿using System;
using ClientOverflow.DataTransferObjects;
using ClientOverflow.ViewModels.Interfaces;
using ClientOverflow.ViewModels.Register;

namespace ClientOverflow.ViewModels.MainMenus
{
    /// <summary>
    /// RegisterCommand command sets the view to Register state.
    /// </summary>
    public class RegisterCommand : INamedCommand
    {
        private readonly IMenusViewModel viewModel;

        public RegisterCommand(IMenusViewModel viewModel)
        {
            this.viewModel = viewModel;
        }

        public string Name
        {
            get { return "Register"; }
        }

        public void Execute(object parameter)
        {
            viewModel.Content = UserRegistrationViewModel.CreateUserRegistrationViewModel(new User());
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;
    }
}